//
// Description: 9. 回文数
// Created by Loading on 2025/4/4.
//

#include <bits/stdc++.h>

using namespace std;

bool isPalindrome(int x) {
    // x为负数或x结尾为0且x不为0
    if (x < 0 || (x % 10 == 0 && x != 0)) {
        return false;
    }
    int revert = 0;
    // 反转一半，revert >= x 时，到达一半
    while (x > revert) {
        revert = revert * 10 + x % 10;
        x /= 10;
    }
    // 奇数位与偶数位判断
    return x == revert / 10 || x == revert;
}

int main() {
    int x = 1222221;

    auto res = isPalindrome(x);

    cout << res << endl;

    return 0;
}
